<template>
	<p class="search-result">你输入的关键字：{{searchWord}}</p>
</template>

<script>
	export default {
		created() {
			this.searchWordChange()
		},
		watch: {
			// 如果路由有变化，会再次执行该方法
    			'$route': 'searchWordChange'
		},
		data () {
			return {
				searchWord:''
			}
		},
		methods: {
			searchWordChange () {
				this.searchWord = this.$route.params.word
			}
		}
	}
</script>

<style>
	.search-result{
		margin: 10px;
	}
</style>